package org.jiuling.request.http;

import org.jiuling.basics.enums.HttpRequestMethodEnum;
import org.jiuling.request.http.core.HttpRequestCore;
import org.jiuling.request.http.enums.SSLProtocolEnum;
import org.jiuling.request.http.model.HttpRequestBody;
import org.jiuling.request.http.model.HttpRequestHeader;
import org.jiuling.request.http.model.HttpRequestParam;
import org.jiuling.request.http.model.HttpResponse;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.URL;

/**
 * http请求接口
 * @author 紫灵
 * @date 2024年08月23日 21时41分24秒
 */
public interface HttpRequest {

    /**
     * 设置代理
     * @param ip IP地址
     * @param port 端口
     * @param proxyType 代理类型
     */
    void setProxy(String ip, int port, Proxy.Type proxyType);

    /**
     * 设置请求方式
     * @param httpRequestMethod HTTP请求方式
     */
    void setHttpRequestMethod(HttpRequestMethodEnum httpRequestMethod);

    /**
     * 设置链接超时
     * @param connectTimeout 链接超时
     */
    void setConnectTimeout(int connectTimeout);

    /**
     * 设置读取超时
     * @param readTimeout 读取超时
     */
    void setReadTimeout(int readTimeout);

    /**
     * 设置请求头
     * @param httpRequestHeader 请求头
     */
    void setHttpRequestHeader(HttpRequestHeader httpRequestHeader);

    /**
     * 设置Http请求参数
     * @param httpRequestParam 请求参数
     */
    void setHttpRequestParam(HttpRequestParam httpRequestParam);

    /**
     * 设置请求内容
     * @param httpRequestBody 请求内容
     */
    void setHttpRequestBody(HttpRequestBody httpRequestBody);

    /**
     * 设置SSL协议
     * @param sslProtocol SSL协议
     */
    void setSSLProtocol(SSLProtocolEnum sslProtocol);

    /**
     * 发送请求
     */
    HttpResponse send() throws IOException;

}
